package com.kyleromano.disgaea;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

public class InnocentEffectListActivity extends Activity {

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.innocents_view);
		
		ViewPagerAdapter adapter = new ViewPagerAdapter();
		ViewPager pager = (ViewPager) findViewById(R.id.innocentsViewPager);
		pager.setAdapter(adapter);
		// Back to Home Screen
				Button back = (Button)this.findViewById(R.id.innocentViewBackButton);
				back.setOnClickListener(new View.OnClickListener() {
			    	   public void onClick(View view) {
			    		   Intent intent = new Intent();
			    		   setResult(RESULT_OK, intent);
			    		   finish();
			    	   }
			       });
	}
	
	private class ViewPagerAdapter extends PagerAdapter {
		 
        public int getCount() {
            return 5;
        }
 
        public Object instantiateItem(View collection, int position) {
 
            LayoutInflater inflater = (LayoutInflater) collection.getContext()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 
            int resId = 0;
            switch (position) {
            case 0:
                resId = R.layout.stat_booster_view;
                break;
            case 1:
                resId = R.layout.ailment_and_resistance_view;
                break;
            case 2:
                resId = R.layout.equipment_booster;
                break;
            case 3:
                resId = R.layout.kill_bonus_other;
                break;
            case 4:
                resId = R.layout.unique;
                break;
            }
 
            View view = inflater.inflate(resId, null);
 
            ((ViewPager) collection).addView(view, 0);
 
            return view;
        }
 
        @Override
        public void destroyItem(View arg0, int arg1, Object arg2) {
            ((ViewPager) arg0).removeView((View) arg2);
 
        }
 
 
        @Override
        public boolean isViewFromObject(View arg0, Object arg1) {
            return arg0 == ((View) arg1);
 
        }
 
        @Override
        public Parcelable saveState() {
            return null;
        }
}
}
